<?php
require_once SITE_PATH . '/apps/photo/Common/common.php';
class PhotoSquareModel extends Model {	
	public function square()
	{
		// 热门推荐相册
		$data['IsHotList'] = IsHotList();
		// 照片
		$order  = NULL;
        switch( $_GET['order'] ) {
        	case 'new':    //最新排行
       			$order = 'cTime DESC';
                break;
            default:      //默认热门排行
                $order = 'readCount DESC';
        }
		$map['privacy']	=	1; //所有人公开的图片

		//获取配置参数
		$config = getConfig();
		$data['photos'] = D('Photo', 'photo')->where($map)->order($order)->findPage(16);
		$data['photo_preview'] = $config['photo_preview'];

		return $data;
	}
}